package cn.iocoder.yudao.module.member.enums;

import cn.hutool.core.util.EnumUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 会员账变类型
 */

@Getter
@AllArgsConstructor
public enum MemberBalanceBizTypeEnum {

    ADMIN_INC(1, "balance.1_008_000_000", "balance.1_008_000_001", true),
    ADMIN_DEC(2, "balance.1_008_000_002", "balance.1_008_000_003", false),
    CHARGE(3, "balance.1_008_000_004", "balance.1_008_000_005", true),
    WITHDRAW(4, "balance.1_008_000_006", "balance.1_008_000_007", false),

    LEVERAGE_APPLY(5, "balance.1_008_000_008", "balance.1_008_000_009", false), //冻结+扣除

    LEVERAGE_REJECT(6, "balance.1_008_000_010", "balance.1_008_000_011", true),
    LEVERAGE_DELAY(7, "balance.1_008_000_012", "balance.1_008_000_013", false),////冻结+扣除
    LEVERAGE_BOND(8, "balance.1_008_000_014", "balance.1_008_000_015", false), //冻结+扣除
    LEVERAGE_INC(9, "balance.1_008_000_016", "balance.1_008_000_017", false), //冻结+扣除
    LEVERAGE_INC_REJECT(10, "balance.1_008_000_018", "balance.1_008_000_019", true),
    LEVERAGE_CLOSE(11, "balance.1_008_000_020", "balance.1_008_000_021", true),
    LEVERAGE_EXPIRE(12, "balance.1_008_000_022", "balance.1_008_000_023", true),
    LEVERAGE_DELAY_REJECT(13, "balance.1_008_000_024", "balance.1_008_000_025", true),

    INVEST_ORDER(14, "balance.1_008_000_026", "balance.1_008_000_027", false),
    INVEST_PROFIT(15, "balance.1_008_000_028", "balance.1_008_000_029", true),
    INVEST_REFUND(16, "balance.1_008_000_030", "balance.1_008_000_031", true),

    SOTCK_BUY(17, "balance.1_008_000_032", "balance.1_008_000_033", false),//冻结+扣除
    //SOTCK_BUY_CANCEL(18, "买入股票撤单", "撤单增加 {} 可用余额", true),

    BLOCK_TRADES_BUY(19, "balance.1_008_000_034", "balance.1_008_000_035", false),

    INVICATION_CHARGE_MANUAL(20, "balance.1_008_000_036", "balance.1_008_000_037", true),
    INVICATION_CHARGE_AUTO(20, "balance.1_008_000_038", "balance.1_008_000_039", true),

    SOTCK_SELL(21, "balance.1_008_000_040", "balance.1_008_000_041", true),

    ACCOUNT_CLOSE(22, "balance.1_008_000_042", "balance.1_008_000_043", true),

    ACCOUNT_EXPIRE(23, "balance.1_008_000_044", "balance.1_008_000_045", true),

    NEW_STOCK_BUY(24, "balance.1_008_000_046", "balance.1_008_000_047", false);

    /**
     * 业务类型
     */
    private final int type;
    /**
     * 标题
     */
    private final String title;
    /**
     * 描述
     */
    private final String description;
    /**
     * 是否为扣减余额
     */
    private final boolean add;

    public static MemberBalanceBizTypeEnum getByType(Integer type) {
        return EnumUtil.getBy(MemberBalanceBizTypeEnum.class,
                e -> Objects.equals(type, e.getType()));
    }
}
